import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * The NormalEnemy is the enemy whit medium difficulty to kill.
 * 
 * @author (Arturo Aaron Rios Obregon) 
 * @version (29 june 2013)
 */
public class NormalEnemy extends Enemy
{
    private int shut;
    /**
     * Constructor
     */
    public NormalEnemy()
    {
        super(25);
        shut=0;
    }
    
    /**
     * The act method makes move the enemies, check if them touch bullets, create items if them die
     * and eliminate the enemies if his lifes is zero.
     */
    public void act() 
    {
        super.mueve();
        super.tocaBala();
        super.creaItem();        
        if(getMoveE()==0)
        {
            
            if(shut%2==0)
            {
                dispara();
                shut=shut%2;
                shut+=1;
                
            }
            else 
                shut+=1;
        }
        super.vidaCero();
        
    }    
    
    /**
     * This method create the enemy bullets
     */
    public void dispara()
    {
        BulletEnemy bala = new BulletEnemy();
        getWorld().addObject(bala,getX(),getY()+25);
    }
}
